package OIandFile;

import java.io.File;

public class Seachfile {
    public static void main(String[] args) {
        seachfile(new File("E:"),"Math");
    }

    public static void  seachfile(File file, String filename){
        if (file==null||!file.isDirectory()) {
            System.out.println("chucuo");;
        }
        final File[] files = file.listFiles();
        if (files == null&&files.length>0) {
            for (File file1 : files) {
                if (file1.isFile()) {
                    if (file1.getName().contains(filename)) {
                        System.out.println("找到对应的文件："+file1.getAbsolutePath());
                    }
                } else {
                    seachfile(file,filename);
                }
            }
        }

    }
}
